import os
import sqlite3

__author__ = 'gongqf'
print os.getcwd()
if os.path.exists(r'e:\web\flask\topshipping'):
    os.chdir(r'e:\web\flask\topshipping')
elif os.path.exists(r'l:\web\flask\topshipping'):
    os.chdir(r'l:\web\flask\topshipping')
elif os.path.exists(r'g:\web\flask\topshipping'):
    os.chdir(r'g:\web\flask\topshipping')

conn=sqlite3.connect('topshipping.db3')

shipcompanys=open(r'static\shipcompany.txt').readlines()
for shipcompany in shipcompanys:
    shipcompany=shipcompany.decode('gbk').strip('\n').split('/')
    conn.execute('replace into shipcompany(shipcompanyname,shipcompanynameen) values(?,?)',(shipcompany[0],shipcompany[1]))
conn.commit()